Core.Storage.Dao.Simple = function(path, storage) {
	this.observers = [];

	this.path = path.slice(1);
	this.storage = path[0] ? Core.Storage.Raw : storage;
	
	var self = this, 
		fn = function() { self.update(); }
	
	this.storage.register(this.path, fn);
	this.value = this.storage.get(this.path);
};

Core.Storage.Dao.Simple.prototype = {
	
	get: function() {
		return this.value;
	},
	
	update: function() {
		this.value = this.storage.get(this.path);

		// Updating the observers
		for(var i = 0, l = this.observers.length; i < l; i++) {
			this.observers[i]();
		}
	},
	
	register: function(fn) {
		this.observers.push(fn);
	},
	
	unregister: function(fn) {
		this.observers.erase(fn);
	}
	
};